<?php 
include("common.php");
$id=$_GET['id'];
$spsql = "select * from admin_user where id='$id'";
$spres = mysql_query($spsql);
$stu=mysql_fetch_array($spres);
if(isset($_POST['submit'])){
	$username = $_POST['username'];
    $password = $_POST['password'];
	$nickname = $_POST['nickname'];
	$email = $_POST['email'];
	$phone = $_POST['phone'];
	$sql = "update admin_user set username='$username',password='$password',nickname='$nickname',email='$email',phone='$phone' where id='$id'";
	$result = mysql_query($sql);
	$rows=mysql_affected_rows();
	if($rows<1){
		echo "<script>alert('修改失败！');window.location.href='admin_user.php';</script>";
	}else{
		echo "<script>alert('修改成功！');window.location.href='admin_user.php';</script>";
	}

}

?>

 <div class="fr righter">
		  <div class="title">
		   <h1 align="center">修改管理员信息</h1>
	      </div>
		  
		  <table class="bd" align="center" width="400">
		  <form action="#" method="post">
		      <tr>
				  <td width="107" align="center" height="30">帐号</td>
			    <td width="281" align="center"><input type="text" name="username"  value="<?php echo $stu['username']?>"/></td>
			  </tr>
			  <tr>
				  <td align="center" height="30">密码</td>
			    <td align="center"><input type="password" name="password"  value="<?php echo $stu['password']?>"/></td>
			  </tr>
			  <tr>
				  <td align="center" height="30">昵称</td>
			    <td align="center"><input type="text" name="nickname"  value="<?php echo $stu['nickname']?>"/></td>
			  </tr>
			  <tr>
				  <td align="center" height="30">邮箱</td>
			    <td align="center"><input type="text" name="email"  value="<?php echo $stu['email']?>"/></td>
			  </tr> 
               <tr>
				  <td align="center" height="30">联系电话</td>
			    <td align="center"><input type="text" name="phone"  value="<?php echo $stu['phone']?>"/></td>
			  </tr>
			  <tr>
				  <td colspan=2 align="center" height="30"><input type="submit" name="submit" value="修改"/></td>
			  </tr>
		  </form>
 </table>

	  </div>
  </div>
  
 </body>
</html>
 

